<%--
  Created by IntelliJ IDEA.
  User: Lenovo
  Date: 2025/6/7
  Time: 14:00
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" %>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>校园论坛 - 注册</title>
    <link rel="stylesheet" type="text/css" href="css/forum_register.css">
    <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
</head>
<body>
<div class="register-container">
    <h1>校园论坛注册</h1>
    <!-- 错误提示区域 -->
    <% if (request.getAttribute("error") != null) { %>
    <div class="error-message">
        <%= request.getAttribute("error") %>
    </div>
    <% } %>
    <form id="registerForm" action="RegisterServlet" method="post">
        <div class="form-group">
            <label for="account">账号</label>
            <input type="text" id="account" name="account" placeholder="请输入账号" required>
            <div id="accountError" class="error-message"></div>  <!-- 新增账号错误提示 -->
        </div>

        <div class="form-group">
            <label for="nickname">昵称</label>
            <input type="text" id="nickname" name="nickname" placeholder="请输入昵称" required>
            <div id="nicknameError" class="error-message"></div>  <!-- 新增昵称错误提示 -->
        </div>

        <div class="form-group">
            <label for="password">密码</label>
            <div class="password-input">
                <input type="password" id="password" name="password" placeholder="请输入密码" required>
                <i class="fas fa-eye toggle-password" data-target="password"></i>
            </div>
            <div id="passwordError" class="error-message"></div>
        </div>

        <div class="form-group">
            <label for="confirmPassword">确认密码</label>
            <div class="password-input">
                <input type="password" id="confirmPassword" name="confirmPassword" placeholder="请再次输入密码" required>
                <i class="fas fa-eye toggle-password" data-target="confirmPassword"></i>
            </div>
            <div id="confirmPasswordError" class="error-message"></div>  <!-- 新增确认密码错误提示 -->
        </div>

        <button type="submit" class="register-btn">注册</button>

        <div class="login-link">
            已有账号？<a href="forum_login.jsp">立即登录</a>
        </div>
    </form>
</div>

<script src="./js/forum_register.js"></script>
</body>
</html>